<template>
  <el-card shadow="never">
    <div slot="header">
      <el-button @click="$router.go(-1)">返回</el-button>
    </div>
    <el-row :gutter="20">
      <el-col :span="6" v-for="(item,index) in list" :key="index">
        <el-card shadow="never" class="mb20">
          <div slot="header" class="flex" style="justify-content: space-between">
            <!-- <span>{{index + 1 }}</span> -->
            <el-button
              class="over-word"
              type="text"
              @click="handleItemClick(item)"
            >{{ item.evalItemName}}</el-button>
            <!-- <p class="mb0" style="flex: 1">{{  }}</p> -->
            <span class="red" style="padding-top: 7px">{{ computedType(item) }}</span>
          </div>
          <div class="flex">
            <p style="flex: 1">
              类别：
              <span>{{ item.evalTypeName }}</span>
            </p>
            <h4>{{ item.dateCd }}</h4>
          </div>
          <div style="background: #f1f1f1;">
            <p style="height: 63px">
              主要内容：
              <span>{{ item.evalItemContent }}</span>
            </p>
            <p style="height: 42px">
              评分标准：
              <span>{{ item.standard }}</span>
            </p>
          </div>
          <div class="flex">
            <p class="mb0" style="flex: 1">
              分值：
              <span>{{ item.rewardScroe }}</span>
            </p>
            <p class="mb0">
              结果：
              <span>{{ item.rewardMoney }}</span>
            </p>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </el-card>
</template>

<script>
import { getPersonalItemDetails } from '@/api/monitor'
import { getMonitorTime } from '@/utils/util'

export default {
  data() {
    return {
      list: [],
      row: JSON.parse(this.$route.query.row)
    }
  },
  methods: {
    handleItemClick(item) {
      console.log('item', item)
      this.$router.push({
        path: '/monitor/monitor-person-itemDetail',
        query: { row: JSON.stringify(item) }
      })
    },
    computedType(item) {
      let str = ''
      if (item.rewardMoney) {
        str = item.rewardMoney.charAt(0) + '钱'
      }

      if (item.rewardScroe) {
        str = item.rewardScroe.charAt(0) + '分'
      }
      return str
    }
  },
  async created() {
    let param = getMonitorTime()
    param = { ...param, userId: this.row.dutyUserId }
    const res = await getPersonalItemDetails(param)
    if (res.state === '000000' && res.data.length > 0) {
      this.list = res.data
    } else {
      this.list = []
    }
  }
}
</script>

<style scoped>
.over-word {
  max-width: 85%;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
